package com.wenson.behavior.iterator;

import sun.security.krb5.internal.PAEncTSEnc;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName: Book
 * @Author: luowangcheng
 * @Date: 2024/6/15 12:32
 * @Description:
 */
public class Book {
    class Page{
        private int index;

        public Page(int index) {
            this.index = index;
        }

        @Override
        public String toString() {
            return "阅读第" + index + '页';
        }
    }

    private List<Page>  pages = new ArrayList<>();

    public Book(int pageSize){
        for (int i = 0; i < pageSize; i++) {
            pages.add(new Page(i + 1));
        }
    }

    public void read(){
        for (Page page : pages) {
            System.out.println(page);
        }
    }
}
